﻿using System;
using Kiva7.DataClasses;

namespace Kiva7.ViewModels
{
    public class LenderViewModel : BaseViewModel
    {
        public LenderViewModel()
        {
        }

        public LenderViewModel(Lender lender)
        {
            Set(lender);
        }

        public LenderViewModel(LoansViewModel loans, TeamViewModel teams)
        {
            // TODO: Complete member initialization
            this._Loans = loans;
            this._Teams = teams;
        }

        public void Set(Lender lender)
        {
            Name = lender != null ? lender.Name : "";
            CountryCode = lender != null ? lender.CountryCode : "";
            Image = lender != null ? lender.Image : null;
            InviteeCount = lender != null ? lender.InviteeCount : 0;
            LenderId = lender != null ? lender.LenderId : "";
            LoanBecause = lender != null ? lender.LoanBecause : "";
            LoanCount = lender != null ? lender.LoanCount : 0;
            Occupation = lender != null ? lender.Occupation : "";
            OccupationalInfo = lender != null ? lender.OccupationalInfo : "";
            PersonalUrl = lender != null ? lender.PersonalUrl : "";
            UID = lender != null ? lender.Uid : "";
            WhereAbouts = lender != null ? lender.WhereAbouts : "";
            MemberSince = lender != null ? lender.MemberSince : null;
        }

        private bool _Isloaded;
        public bool IsLoaded
        {
            get
            {
                return _Isloaded;
            }
            set
            {
                if (_Isloaded != value)
                {
                    _Isloaded = value;
                    NotifyPropertyChanged("IsLoaded");
                }
            }
        }

        private string _Name;
        public string Name
        {
            get
            {
                return _Name;
            }
            set
            {
                if (value != _Name)
                {
                    _Name = value;
                    NotifyPropertyChanged("Name");
                }
            }
        }

        
        
        private string _LenderId;
        public string LenderId
        {
            get
            {
                return _LenderId;
            }
            set
            {
                if (value != _LenderId)
                {
                    _LenderId = value;
                    NotifyPropertyChanged("LenderId");
                }
            }
        }
        
        private DateTime? _MemberSince;
        public DateTime? MemberSince
        {
            get
            {
                return _MemberSince;
            }
            set
            {
                if (value != _MemberSince)
                {
                    _MemberSince = value;
                    NotifyPropertyChanged("MemberSince");
                }
            }
        }

        
        private int _LoanCount;
        public int LoanCount
        {
            get
            {
                return _LoanCount;
            }
            set
            {
                if (value != _LoanCount)
                {
                    _LoanCount = value;
                    NotifyPropertyChanged("LoanCount");
                }
            }
        }

        
        private int _InviteeCount;
        public int InviteeCount
        {
            get
            {
                return _InviteeCount;
            }
            set
            {
                if (value != _InviteeCount)
                {
                    _InviteeCount = value;
                    NotifyPropertyChanged("InviteeCount");
                }
            }
        }

        
        private Kiva7.DataClasses.Image _Image;
        public Kiva7.DataClasses.Image Image
        {
            get
            {
                return _Image;
            }
            set
            {
                if (value != _Image)
                {
                    _Image = value;
                    NotifyPropertyChanged("Image");
                }
            }
        }

        
        private string _WhereAbouts;
        public string WhereAbouts
        {
            get
            {
                return _WhereAbouts;
            }
            set
            {
                if (value != _WhereAbouts)
                {
                    _WhereAbouts = value;
                    NotifyPropertyChanged("WhereAbouts");
                }
            }
        }

        
        private string _CountryCode;
        public string CountryCode
        {
            get
            {
                return _CountryCode;
            }
            set
            {
                if (value != _CountryCode)
                {
                    _CountryCode = value;
                    NotifyPropertyChanged("CountryCode");
                }
            }
        }

        
        private string _UID;
        public string UID
        {
            get
            {
                return _UID;
            }
            set
            {
                if (value != _UID)
                {
                    _UID = value;
                    NotifyPropertyChanged("UID");
                }
            }
        }

        
        private string _PersonalUrl;
        public string PersonalUrl
        {
            get
            {
                return _PersonalUrl;
            }
            set
            {
                if (value != _PersonalUrl)
                {
                    _PersonalUrl = value;
                    NotifyPropertyChanged("PersonalUrl");
                }
            }
        }

        
        private string _Occupation;
        public string Occupation
        {
            get
            {
                return _Occupation;
            }
            set
            {
                if (value != _Occupation)
                {
                    _Occupation = value;
                    NotifyPropertyChanged("Occupation");
                }
            }
        }

        
        private string _LoanBecause;
        public string LoanBecause
        {
            get
            {
                return _LoanBecause;
            }
            set
            {
                if (value != _LoanBecause)
                {
                    _LoanBecause = value;
                    NotifyPropertyChanged("LoanBecause");
                }
            }
        }

        
        private string _OccupationalInfo;
        
        public string OccupationalInfo
        {
            get
            {
                return _OccupationalInfo;
            }
            set
            {
                if (value != _OccupationalInfo)
                {
                    _OccupationalInfo = value;
                    NotifyPropertyChanged("OccupationalInfo");
                }
            }
        }

        private LoansViewModel _Loans;
        public LoansViewModel Loans
        {
            get
            {
                return _Loans;
            }
        }

        private TeamViewModel _Teams;
        public TeamViewModel Teams
        {
            get
            {
                return _Teams;
            }
        }

    }
}
